﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"
    CodeBehind="Edit.aspx.cs" Inherits="MVCClubSite.Web.Views.Links.Edit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="contentblock">
        <h2>
            Create New Link</h2>
        <% using (Html.BeginForm("Update", "Links", new { @id = ViewData.Model.Link.ID }, FormMethod.Post, new { @enctype = "multipart/form-data" }))
           { %>
        <table>
            <tr>
                <td>
                    <%= Html.Label("title", "Title:") %>
                </td>
                <td>
                    <%= Html.TextBox("title", ViewData.Model.Link.Title) %>
                </td>
            </tr>
            <tr>
                <td>
                    <%= Html.Label("url", "Url:") %>
                </td>
                <td>
                    <%= Html.TextBox("url", ViewData.Model.Link.Url)%>
                </td>
            </tr>
            <tr>
                <td>
                    <%= Html.Label("description", "Description:") %>
                </td>
                <td>
                    <%= Html.TextArea("description", ViewData.Model.Link.Description , 4, 60, null)%>
                </td>
            </tr>
            <tr>
                <td>
                    <%= Html.Label("image", "Image:") %>
                </td>
                <td>
                    <input type="file" name="image" id="image" size="40" />
                    <br />
                    <% if (ViewData.Model.Link.Image != null)
                       { %>
                    <%= Html.CheckBox("deleteImage")%>
                    <%= Html.Label("deleteImage", "Delete the existing image.")%><br />
                    <%=  Html.Image("~/Images/LinkImage/" + ViewData.Model.Link.ID)%>
                    <% }
                       else
                       { %>
                    <%= Html.Hidden("deleteImage", "false") %>
                    <%} %>
                </td>
            </tr>
            <tr>
                <td>
                    <%= Html.Label("sequence", "Sequence") %>
                </td>
                <td>
                    <%= Html.TextBox("sequence", ViewData.Model.Link.Sequence)%>
                </td>
            </tr>
            <tr>
                <td>
                    <input type="submit" name="submit" value="Save" />
                    <% } %>
                </td>
                <td>
                    <% using (Html.BeginForm("Delete", "Links", new { @id = ViewData.Model.Link.ID }, FormMethod.Post, new { onsubmit = "return confirmDelete()" }))
                       { %>
                    <input type="submit" value="Delete" id="deleteButton" />
                    <%} %>
                </td>
            </tr>
        </table>
    </div>

    <script type="text/javascript">
        function confirmDelete() {
            return confirm("You are about delete this link.  Are you sure?");
        }
    </script>

    <script type="text/javascript" src="<%=AppHelper.JavascriptUrl("tinymce/tiny_mce.js") %>"></script>

    <script type="text/javascript" src="<%=AppHelper.JavascriptUrl("tinymce/advanced_config.js") %>"></script>

</asp:Content>
